<?php
/**
 * RequestHandler class definition
 *  
 * @author Sean Crystal <seancrystal@gmail.com>
 * @package MVP-PHP
 */        
 
/**
 * Base class that provides functionality to add handlers to a Request
 * object for processing. It looks for methods that start with Handle and 
 * matches the rest of the function name against a Request action.
 * @package MVP-PHP
 * @subpackage Base
 */      
class RequestHandler extends PropertyObject
{
	/**
     * Look through the class methods to see if any match the Request action.
	 * @param Request $request
	 */  	
	protected function SetupHandlers(Request $request)
	{
		$methods = get_class_methods(get_class($this));
		
		if (is_array($methods)) {
			foreach ($methods as $method) {
				if (strcasecmp($method, "Handle{$request->action}") === 0) {
					$request->AddHandler(array($method, &$this));
				}
			}
		}
	}
}

?>